﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.ComponentModel.Design;
using System.Data;
using System.Data.SqlClient;

public partial class manage_Setstoptime : System.Web.UI.Page
{
    public static string date;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            databinds(qsDropDownList.Text);
        }
    }

    private void  databinds(string type)
    {
        string sql = "select pre_opentime from [dbo].[LotteryQs] where [LotteryType] =" + qsDropDownList.Text;
        string pre_opentime = BLL.LotteryQs.GetPageListBysql(sql).Rows[0][0].ToString();
        //string  jq=  pre_opentime.Substring(11, pre_opentime.Length + 1);
        string[] strjq = pre_opentime.Split(' ');
        string time = strjq[1].ToString();
        string[] times = time.Split(':');
        string ihour = times[0].ToString();
        string iMinute = times[1].ToString();
        string iSecond = times[2].ToString();
        SDropDownList.SelectedItem.Text = ihour;
        FDropDownList.SelectedItem.Text = iMinute;
        MDropDownList.SelectedItem.Text = iSecond;
        date = strjq[0].ToString();
    }


    protected void qsSelectedIndexChanged(object sender, EventArgs e)
    {
        databinds(qsDropDownList.SelectedItem.Text);
    }

   

    protected void updatetime__Click(object sender, EventArgs e)
    {

        string hour = SDropDownList.SelectedItem.Text;
        string minute = FDropDownList.SelectedItem.Text;
        string second = MDropDownList.SelectedItem.Text;
        string times = date + " " + hour + ":" + minute + ":" + second;
        string sql = "update [dbo].[LotteryQs] set [pre_opentime] ='"+ times+"'  where   [LotteryType] ='"+ qsDropDownList.Text + "'";
        if (BLL.LotteryQs.Update(sql) > 0)
        {

            Response.Write("<script>alert('修改成功');</script>");

        }

    }
}